Release 10.1A: OpenEdge Development:
Programming Interfaces


Managing and transporting crypto data

Crypto data consists of all the information required to maintain secure data. This includes the source data, typically in clear-text form; the encrypted or hashed data; all passwords, key values, and algorithms; and all platform parameters required to maintain the data, such as code pages for character strings and the byte endian order for binary values.

This section describes some of the basic objectives and requirements for managing crypto data in the 4GL. For more information on the larger and more complex factors that you need to consider when using cryptography, see the Security whitepaper prepared by Progress Marketing, which can be found on the PSDN Web site.

Caution: Managing crypto data incorrectly can result in the loss of your original source data. You must ensure that all interactions with this data are both safe and secure.
Objectives for crypto data management

The main objectives for managing and transporting crypto data is the same for all types of encryption and data:

Requirements for crypto data management

The requirements for managing and transporting crypto data depend upon the:

One general requirement for managing encrypted or digested data is to be certain that all keys once generated, are recoverable. For example, if you use the GENERATE-RANDOM-KEY function to set a symmetric key and you use this function to directly set the SYMMETRIC-ENCRYPTION-KEY attribute of the SECURITY-POLICY system handle, the key value that you set is non-recoverable because the SYMMETRIC-ENCRYPTION-KEY attribute is write-only. If you encrypt data using this setting, you can never decrypt it after the 4GL session in which you encrypt the data has ended. Therefore, to correctly use the GENERATE-RANDOM-KEY function for symmetric encryption, you must set and maintain the value of a readable variable using this function and then set the SYMMETRIC-ENCRYPTION-KEY attribute using this variable. Of course, you must also ensure that you immediately save the key value in a secure location and erase the value in memory in order to both secure your current 4GL session and safely recover the key value at a later time to decrypt whatever data you have encrypted with it.

Crypto data storage

If you use external files to store crypto keys, passwords, and data make certain that you use secure operating system files to do it.

If you use a database to store crypto data, be sure to secure any keys or passwords that you store in the database separately from the data that you have encrypted.

Caution: Never encrypt a password required to access encrypted data using the same password-based encryption (PBE) key used to encrypt the data. Always manage the password separately from the data that you intend to encrypt with it, and always manage the password separately from any salt that you combine with the password to generate the PBE key.
Crypto data management and transport

When you store or transport crypto data, you can do it in two basic forms:

Caution: If encrypted data is not in the correct byte order or format, the DECRYPT function has no way of knowing this and will successfully “decrypt” the data to an invalid value.

If you store encrypted data in a database:

Caution: If you encrypt data in a database, other applications that use the database, such as Crystal Reports, might not work as you want.
Planning for changes in size for encrypted data

Data size increases at two points:

The formula for change in data size during symmetric encryption is:

ems = (((ums / 8) + 1) * 8) 

In this formula:

The formula for change in data size when Base64-encoding a binary byte stream is:

ems = (((bms / 8) + 1) * 8) 

This increase in size from binary to Base64-encoding is generally 33%. So, encrypted data in a RAW or MEMPTR variable becomes 33% larger after you convert to a Base64-encoded CHARACTER or LONGCHAR variable.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095